﻿ 

	
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="客户合同">  
    <meta name="description" content="客户合同">  
    <title>客户合同管理</title>  
    
    <%@ include file="/WEB-INF/inc/default.jsp"%>
    <jsp:include page="/WEB-INF/inc/dic.jsp"/>

</head>  
<body>  
    
      
    <table id="dg" title="客户合同管理" style="width:1100px;height:250px"  
            url="/customer/customerContract/list.do"  
            toolbar="#toolbar" pagination="true"  
            rownumbers="true" fitColumns="true" loadMsg="正在查询,请稍候..." singleSelect="false">  

    </table>  
    <div id="toolbar">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">修改</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deletes()">删除</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="find()">查询</a>
    </div>  
    <!-- edit form窗体（开始） -->  
    <div id="dlg" class="easyui-dialog" style="width:600px;height:280px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons">  
        <form id="fm" method="post" novalidate>  
        	  	  	 <input type="hidden" name="id" > 
	        		     <div class="fitem">  
                     <label style="width:100px">合同编号<font color="red">*</font>:</label>                                            
                     <input name="nbr" class="easyui-box easyui-validatebox"  required="true">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">客户id<font color="red">*</font>:</label>                       
                     <input name="custId" class="easyui-numberbox easyui-validatebox"  required="true">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">title:</label>                                            
                     <input name="title" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">合同格式<font color="red">*</font>:</label>  
                     <input class="easyui-combobox"  required="true" name="contractStyle" style="width:200px;"  data-options="data:__getConstantCategory('ContractStyle'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">合同类型(字典获取):*固定收费-有预付 *固定收费 *年收费-月薪-最低收费-预付 *年收费-年薪-最低收费 <font color="red">*</font>:</label>  
                     <input class="easyui-combobox"  required="true" name="contractType" style="width:200px;"  data-options="data:__getConstantCategory('ContractType'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
	        		     <div class="fitem">  
                     <label style="width:100px">合同语种<font color="red">*</font>:</label>                                            
                     <input name="lang" class="easyui-box easyui-validatebox"  required="true">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">合同费率<font color="red">*</font>:</label>                                            
                     <input name="arRate" class="easyui-box easyui-validatebox"  required="true">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">最低收费<font color="red">*</font>:</label>                       
                     <input name="minAr" class="easyui-numberbox easyui-validatebox"  required="true">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">合同开始日期<font color="red">*</font>:</label>                       
                     <input name="beginD" data-options="formatter:formateDate"  class="easyui-datebox easyui-validatebox"  required="true">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">合同结束日期<font color="red">*</font>:</label>                       
                     <input name="endD" data-options="formatter:formateDate"  class="easyui-datebox easyui-validatebox"  required="true">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">付款时间:</label>                       
                     <input name="arD" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">预付款:</label>                       
                     <input name="preAr" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">预付款时间:</label>                       
                     <input name="preArD" data-options="formatter:formateDate"  class="easyui-datebox">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">预付款单位:</label>                                            
                     <input name="preUnit" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">保证期(试用期):</label>                                            
                     <input name="trialMonths" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">退款比例:</label>                       
                     <input name="refundRate" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">滞纳金比例:</label>                       
                     <input name="delayRate" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">其他特别条款:</label>                                            
                     <input name="searchLimit" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">其他备注:</label>                                            
                     <input name="comment" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建人:</label>                                            
                     <input name="creator" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建时间:</label>                       
                     <input name="createDt" data-options="formatter:formateDate"  class="easyui-datebox">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">修改人:</label>                                            
                     <input name="modifier" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">修改时间:</label>                       
                     <input name="modifiedDt" data-options="formatter:formateDate"  class="easyui-datebox">                       
                   </div>  	        		     
        </form>  
    </div>  
    <!-- edit form窗体（结束） -->  
    <!-- query form窗体(开始) -->  
    <div id="dlg_query" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons-query">  
        <div class="ftitle">客户合同</div>  
        <form id="fm_query" method="post" novalidate>  
            
              
	        		     <div class="fitem">  
                     <label style="width:100px">合同编号:</label>                                            
                     <input name="nbr" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">客户id:</label>                       
                     <input name="custId" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">title:</label>                                            
                     <input name="title" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">合同格式:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="contractStyle" style="width:200px;"  data-options="data:__getConstantCategory('ContractStyle'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">合同类型(字典获取):*固定收费-有预付 *固定收费 *年收费-月薪-最低收费-预付 *年收费-年薪-最低收费 :</label>                                            
                     
                     
                     <input class="easyui-combobox" name="contractType" style="width:200px;"  data-options="data:__getConstantCategory('ContractType'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">合同语种:</label>                                            
                     <input name="lang" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">合同费率:</label>                                            
                     <input name="arRate" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">最低收费:</label>                       
                     <input name="minAr" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">合同开始日期:</label>                       
                     <input name="beginD" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">合同结束日期:</label>                       
                     <input name="endD" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">付款时间:</label>                       
                     <input name="arD" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">预付款:</label>                       
                     <input name="preAr" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">预付款时间:</label>                       
                     <input name="preArD" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">预付款单位:</label>                                            
                     <input name="preUnit" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">保证期(试用期):</label>                                            
                     <input name="trialMonths" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">退款比例:</label>                       
                     <input name="refundRate" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">滞纳金比例:</label>                       
                     <input name="delayRate" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">其他特别条款:</label>                                            
                     <input name="searchLimit" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">其他备注:</label>                                            
                     <input name="comment" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建人:</label>                                            
                     <input name="creator" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建时间:</label>                       
                     <input name="createDt" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">修改人:</label>                                            
                     <input name="modifier" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">修改时间:</label>                       
                     <input name="modifiedDt" data-options="formatter:formateDate" class="easyui-datebox">                         	
                   </div>  	        		     
              
              
        </form>  
    </div> 
    <!-- query form窗体(结束) -->  
    <div id="dlg-buttons">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">Save</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">关闭</a>  
    </div>  
    <div id="dlg-buttons-query">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="query()">确定</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_query').dialog('close')">关闭</a>  
    </div>  
    <script type="text/javascript">  
        var url;  
        function add(){         	 
            $('#dlg').dialog('open').dialog('setTitle','新增客户合同');  
            $('#fm').form('clear');  
            url = '/customer/customerContract/save.do';  
        }  
        function edit(){  
            //var row = $('#dg').datagrid('getSelected');  
            var rows = $('#dg').datagrid('getSelections');
            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要修改的行','info');
            	 return;
            }
            if (!rows||rows.length>1){
            	 $.messager.alert('提示','不能选择多行','info');
            	 return;
            }
            if (rows){  
                $('#dlg').dialog('open').dialog('setTitle','修改客户合同');  
                //$('#fm').form('load',rows[0]);  
                $('#fm').form('load','/customer/customerContract/get.do?id='+rows[0].id);  
                url = '/customer/customerContract/update.do';
            }  
        }  
        function save(){          	   
        	  if (!$('#fm').form('validate')) return; 
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');                      
                    if (result.success == true){  
                        $.messager.alert('信息',result.msg,'info');  
                        $('#dlg').dialog('close');      // close the dialog  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.alert('错误',result.msg,'error');
                    }  
                }  
            });  
        }  
        function deletes(){  
            var row = $('#dg').datagrid('getSelected');  
            
            var rows = $('#dg').datagrid('getSelections');  

            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要删除的行','info');
            	 return;
            }
            if (rows){  
                $.messager.confirm('重要提示','确定要删除?',function(r){  
                    if (r){  
                        $.post('/customer/customerContract/delete.do',{ids:getRecordArray(rows,'id').join(',')},function(result){  
                            if (result.success){  
                                $('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                                 
                                $.messager.alert('错误',result.errorMsg,'error'); 
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
        function find(){  
              
                $('#dlg_query').dialog('open').dialog('setTitle','查询');  
                
                url = '/customer/customerContract/list.do';  
              
        } 
        	
        function query(){  
                
                //var aa=$('#fm_query').formSerialize();
                var formdata=$('#fm_query').formToArray();
                //var dd= JSON.stringify(cc); 
                
                if (!$('#fm_query').form('validate')) return; 
                $('#dg').datagrid({
	                  queryParams: array2json(formdata)
                });
               $('#dlg_query').dialog('close');
              
        }
        
        //生成grid的字段,需要字典的自动转换
        $('#dg').datagrid({
        	   columns:[[
        	   	
        	   	   {field:'nbr',title:'合同编号', width:100}
        	   	   ,{field:'custId',title:'客户id', width:100}
        	   	   ,{field:'title',title:'title', width:100}
        	   	   ,{field:'contractStyle',title:'合同格式', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('ContractStyle', value);
        	   		      }
        	   	     }
        	   	   ,{field:'contractType',title:'合同类型(字典获取):*固定收费-有预付 *固定收费 *年收费-月薪-最低收费-预付 *年收费-年薪-最低收费 ', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('ContractType', value);
        	   		      }
        	   	     }
        	   	   ,{field:'lang',title:'合同语种', width:100}
        	   	   ,{field:'arRate',title:'合同费率', width:100}
        	   	   ,{field:'minAr',title:'最低收费', width:100}
        	   	   ,{field:'beginD',title:'合同开始日期', width:100}
        	   	   ,{field:'endD',title:'合同结束日期', width:100}
        	   	   ,{field:'arD',title:'付款时间', width:100}
        	   	   ,{field:'preAr',title:'预付款', width:100}
        	   	   ,{field:'preArD',title:'预付款时间', width:100}
        	   	   ,{field:'preUnit',title:'预付款单位', width:100}
        	   	   ,{field:'trialMonths',title:'保证期(试用期)', width:100}
        	   	   ,{field:'refundRate',title:'退款比例', width:100}
        	   	   ,{field:'delayRate',title:'滞纳金比例', width:100}
        	   	   ,{field:'searchLimit',title:'其他特别条款', width:100}
        	   	   ,{field:'comment',title:'其他备注', width:100}
        	   	   ,{field:'creator',title:'创建人', width:100}
        	   	   ,{field:'createDt',title:'创建时间', width:100}
        	   	   ,{field:'modifier',title:'修改人', width:100}
        	   	   ,{field:'modifiedDt',title:'修改时间', width:100}
        	   	
        	   	
        	   ]]
        	   ,onDblClickRow: function(rowIndex, rowData){
        	    	$('#dlg').dialog('open').dialog('setTitle','修改客户合同');                  
                $('#fm').form('load','/customer/customerContract/get.do?id='+rowData.id);  
                url = '/customer/customerContract/update.do';        	    	
        	    }
        }); 
        //完成-生成grid的字段
        
        
        
    </script>  
     
     

     
     
     
</body>  
</html>